/*
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-08-21 18:46:40
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-08-23 23:03:22
 * @FilePath: \四阶段\src\store\LoginLogStore.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {makeAutoObservable} from 'mobx'
import services  from '../service'

class LoginLogStore{
    constructor(){
        makeAutoObservable(this)
      }
      currentPage=1
      pageSize=5
      total=''
      LoginLogList=[]; //登录日志列表数据
      timeInfo={
        startTime:'',
        endTime:''
      }  //时间选择器信息
      //获取列表数据方法
      getLoginLogList=(currentPage,pageSize)=>{
           return new Promise((resolve,reject)=>{
          services.loginlogService.getAllDataList(currentPage,pageSize).then((data)=>{
            resolve(data)
            console.log(data.data,"getLoginLogList");
            this.LoginLogList=data.data
            // console.log(this.LoginLogList,'getLoginLogList');
          })
           })
      } 

      //快速搜索按钮方法
      getSeachList=()=>{
        return new Promise((resolve,reject)=>{
          services.loginlogService.searvhBtn().then((data)=>{
            resolve(data.data)
            this.LoginLogList=data.data
            console.log(this.LoginLogList,'getSeachList');
          })
           })
      }
      //删除所有方法
      deleteAllData=()=>{
        return new Promise((resolve,reject)=>{
          services.loginlogService.deleteAllData().then((data)=>{
            resolve(data)
            console.log(data.data);
            this.LoginLogList=data.data
          })
        })
      }
      //删除按钮方法
      deleteBtnfun=(login_id)=>{
        return new Promise((resolve,reject)=>{
          services.loginlogService.deleteBtn(login_id).then((data)=>{
            resolve(data)
            console.log(data);
          })
        })
      }
} 
export default LoginLogStore